<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:oui="clr-namespace:OpenLS.UI"
                    x:Class="OpenLS.UI.Themes.TabItemResources"
                    xmlns:ouit="clr-namespace:OpenLS.UI.Themes"
    >
    <ResourceDictionary.MergedDictionaries>
        <ouit:AccessKeyResources/>
        <ResourceDictionary Source="AccessKeyResources.xaml"/>
    </ResourceDictionary.MergedDictionaries>




    <Style TargetType="{x:Type TabItem}" x:Key="ribbonTabItemStyle">
        <Setter Property="FocusVisualStyle">
            <Setter.Value>
                <Style>
                    <Setter Property="Control.Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Rectangle Stroke="#FF000000" StrokeThickness="1" Margin="3,3,3,1" x:Name="Rectangle" SnapsToDevicePixels="True">
                                    <Rectangle.StrokeDashArray>
                                        <DoubleCollection>
                                            <System:Double>1</System:Double>
                                            <System:Double>2</System:Double>
                                        </DoubleCollection>
                                    </Rectangle.StrokeDashArray>
                                </Rectangle>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <EventSetter Event="MouseDoubleClick" Handler="OnTabItemDoubleClick"/>
        <EventSetter Event="PreviewMouseLeftButtonDown" Handler="OnTabItemClick"/>
        <Setter Property="Padding" Value="12,2,12,2"/>
        <Setter Property="BorderThickness" Value="1,1,1,0"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static oui:OfficeBrushes.TextForegroundKey}}"/>
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border x:Name="Border" SnapsToDevicePixels="True" >
                        <Grid Margin="0,5,1,0" x:Name="Grid">
                            <Grid x:Name="Transform">
                                <Border Background="{TemplateBinding Background}" x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,3,0,0"/>
                            </Grid>
                            <Border x:Name="Border1" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                <ContentPresenter 
                  HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, Mode=FindAncestor, AncestorType={x:Type ItemsControl}}}"
                                  VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, Mode=FindAncestor, AncestorType={x:Type ItemsControl}}}"
                  x:Name="ContentPresenter"
                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                  Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}"
                  RecognizesAccessKey="True" ContentSource="Header" />
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource {x:Static oui:OfficeBrushes.RibbonBorderBrushKey}}" TargetName="Bd"/>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static oui:OfficeBrushes.TabItemHighlightedBackgroundKey}}"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="1"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource {x:Static oui:OfficeBrushes.RibbonBorderBrushKey}}" TargetName="Bd"/>
                            <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.TabItemSelectedBackgroundKey}}" TargetName="Bd"/>
                        </Trigger>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Parent.State}" Value="{x:Static oui:RibbonState.Minimized}">
                            <Setter Property="Panel.ZIndex" Value="0"></Setter>
                            <Setter Property="BorderBrush" Value="{x:Null}" TargetName="Bd"/>
                            <Setter Property="Background" TargetName="Bd" Value="{x:Null}"/>
                        </DataTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="IsMouseOver" Value="True" SourceName="Border"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush" Value="Orange" TargetName="Bd"/>
                        </MultiTrigger>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter Property="LayoutTransform" TargetName="Transform">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="1" ScaleY="-1"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter Property="LayoutTransform" TargetName="Transform">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter Property="LayoutTransform" TargetName="Transform">
                                <Setter.Value>
                                    <RotateTransform Angle="90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            <Setter Property="Background" Value="#FFF5F4EA" TargetName="Bd"/>
                            <Setter Property="BorderBrush" Value="#FFC9C7BA" TargetName="Bd"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="TabStripPlacement" Value="Top"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-0,-0,-0,-1"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="TabStripPlacement" Value="Bottom"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-2,-2,-2,-2"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="TabStripPlacement" Value="Left"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-2,-2,-1,-2"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="TabStripPlacement" Value="Right"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-1,-2,-2,-2"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>